package service

import (
	"workflow/config"
	"workflow/entity"
)

func ListProjects() (projects []entity.Project, err error) {
	err = config.DB.Find(&projects).Error
	if err != nil {
		return nil, err
	}
	return projects, nil
}

func CreateProject(name, description string) (err error) {
	project := entity.Project{
		Name:        name,
		Description: description,
	}
	err = config.DB.Create(&project).Error
	return err
}
